package codeRose.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import codeRose.domain.Customer;
import codeRose.domain.Goods;
import codeRose.domain.Worker;
import codeRose.mapper.UserMapper;

@Service("userService")

public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
/*    @Autowired
    private CostMapper costMapper;*/

    @Override
    public Customer login(String name, String password, String identify) {
        // TODO Auto-generated method stub
        return userMapper.findWithLoginAndPassword(name, password, identify);
    }

	@Override
	public int signup(String name, String password, String nickname,String email,String sex,String address,String phone) {
		// TODO Auto-generated method stub
		return userMapper.insert(name, password, nickname, email, sex, address, phone);
	}

	@Override
	public List<Goods> listGoods() {
		// TODO Auto-generated method stub
		return userMapper.listGoods();
	}
/*
	@Override
	public int addGoods(String name, String price, String number, String buytime, int userid) {
		// TODO Auto-generated method stub
		return costMapper.addGoods(name, price, number, buytime, userid);
	}

	@Override
	public int deleteGoods(int id) {
		// TODO Auto-generated method stub
		return costMapper.deleteGoods(id);
	}*/

	@Override
	public Worker Mlogin(String name, String password, String identify) {
		// TODO Auto-generated method stub
		return userMapper.ManagerLogin(name, password, identify);
	}

	@Override
	public int addGoods(String name, Integer price, String type, String discount, String createtime, String limittime,
			String productby, String size, String pic,Integer number) {
		// TODO Auto-generated method stub
		return userMapper.addGoods(name, price, type, discount, createtime, limittime, productby, size, pic,number);
	}

	@Override
	public int confirm(Integer id) {
		// TODO Auto-generated method stub
		return userMapper.confirm(id);
	}

}